package beautiful.butterfly.drds.datasource.connection_contexts.spi.thread;

//import beautiful.butterfly.drds.datasource.author.Author;
//import beautiful.butterfly.drds.datasource.author.Authors;

import beautiful.butterfly.drds.datasource.connection_contexts.spi.ConnectionContexts;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

//@Author(name = Authors.LI_YANG)
public class DestroyConnectionContextTask implements Runnable {
    public static final Logger logger = LoggerFactory.getLogger(DestroyConnectionContextTask.class);
    private ConnectionContexts connectionContexts;

    public DestroyConnectionContextTask(ConnectionContexts connectionContexts) {
        this.connectionContexts = connectionContexts;
        logger.info("----");
    }

    public void run() {
        logger.info("shrink");
        this.connectionContexts.shrink(true, this.connectionContexts.keepAlive);
        logger.info("removeAbandonedPooledConnectionList");
        this.connectionContexts.removeAbandonedPooledConnectionList();
    }

}
